addHook("PlayerSpawn", function(p)
	if (not (gametyperules & GTR_CAMPAIGN)) or (mapheaderinfo[gamemap].pistolstart and (string.lower(mapheaderinfo[gamemap].pistolstart) == "true" or string.lower(mapheaderinfo[gamemap].pistolstart) == "on" or mapheaderinfo[gamemap].pistolstart == "1")) then
		//print("fart")
		p.phealth = 100
		p.parmor = 0
		p.papval = 0
		p.gunsinitialized = false
	end
end)

/*addHook("MapLoad", function(p)
	if (not (gametyperules & GTR_CAMPAIGN)) or (mapheaderinfo[gamemap].pistolstart and (string.lower(mapheaderinfo[gamemap].pistolstart) == "true" or string.lower(mapheaderinfo[gamemap].pistolstart) == "on" or mapheaderinfo[gamemap].pistolstart == "1")) then
		//print("fart")
		for p in players.iterate do
			p.phealth = 100
			p.parmor = 0
			p.papval = 0
			p.gunsinitialized = false
		end
	end
end)*/

addHook("PlayerThink", function(p)
	if p.spectator or p.playerstate == PST_DEAD then
		p.gunsinitialized = false
	end
	//print(p.gunsinitialized)
	if (not p.gunsinitialized) and (not p.spectator) then
	//clear inventory if we had one
		p.slot = nil
		p.weapon = nil
		//p.raiselowercounter = 0
		//p.weaponframe = nil
		//p.frameduration = nil
		//p.flashstate = nil
		//p.flashframe = nil
		//p.fframeduration = nil
		//p.switchto = nil
		//p.switchslot = nil
		//p.refire = false
		p.weaponslist = {
			[1] = {},
			[2] = {},
			[3] = {},
			[4] = {},
			[5] = {},
			[6] = {},
			[7] = {},
			[8] = {},
			[9] = {},
			[10] = {},
		}
		p.ammolist = {
			[1] = 50,
			[2] = 0,
			[3] = 0,
			[4] = 0,
		}
	//initialization
		//print("BRAPPP")
		//print("BRAPPP")
		//print("BRAPPP")
		//print("BRAPPP")
		//print("BRAPPP")
		//print("BRAPPP")
		RFW.GivePlayerWeapon(p, 1, RFW.WP_knife)
		RFW.GivePlayerWeapon(p, 2, RFW.WP_pistol)
		p.weaponstate = "Raise"
		p.slot = 2
		p.weapon = RFW.WP_pistol
		p.raiselowercounter = 32
		p.weaponframe = 1
		p.frameduration = 2
		p.flashstate = nil
		p.flashframe = nil
		p.fframeduration = nil
		p.switchto = nil
		p.switchslot = nil
		p.gunsinitialized = true
	end
end)

COM_AddCommand("lordpleaselendmeyourlight", function(p)
	RFW.GivePlayerWeapon(p, 1, RFW.WP_flashlight) //I LOVE PENISSSSSSSSSSSSSSSSSSSSSSSSSSSSSS - mental added this code comment for some reason
end)

COM_AddCommand("lordpleaselendmeyourlight2", function(p)
	RFW.GivePlayerWeapon(p, 1, RFW.WP_flashlight)
end, COM_SPLITSCREEN)